package com.doctor.utils.eventBus;


import org.greenrobot.eventbus.EventBus;

/**
 * eventBus的util
 * Created by chemin on 2016/11/30.
 */
public class EventBusUtil {

    public static void registEventBus(Object subscriber){
        if (subscriber!=null){
            EventBus.getDefault().register(subscriber);
        }
    }

    public static void unRegistEventBus(Object subscriber){
        if (subscriber!=null){
            EventBus.getDefault().unregister(subscriber);
        }
    }

    /**
     * 传递普通消息
     * @param event
     */
    public static void postEvent(Object event){
        if (event!=null){
            EventBus.getDefault().post(event);
        }
    }

    /**
     * 传递粘性消息
     * @param event
     */
    public static void postStickyEvent(Object event){
        if (event!=null){
            EventBus.getDefault().postSticky(event);
        }
    }


}
